<?php
class FeedbacksController extends AdminAppController
{
    public $uses = array('Admin.Feedback');

    public $paginate = array(
        'limit' => 25,
        'order' => array(
            'Feedback.read' => 'desc',
        ),
    );

    public function index()
    {
        $data = $this->paginate('Feedback');
     
        $this->set(compact('data'));
    }

    public function read($id=null)
    {
        if ($id == null) {
            $this->redirect('/admin/feedbacks');
        } 
        $this->Feedback->id = $id;
        if ($this->Feedback->saveField('is_read', 1)) {
            $this->redirect('/admin/feedbacks');
        }
    }
} 
